#include "string.h"

//set memory with "value" where "start" pointed
void 
memorySetValue (void *start, char value, int size)
{
  char *from = (char *)start;

  for (int i=0; i<size; i++)
    from[i] = value;
  return;
}


// Like strncpy but guaranteed to NUL-terminate.
char*
safeStrcpy(char *s, const char *t, int n)
{
  char *os;
  
  os = s;
  if(n <= 0)
    return os;
  while(--n > 0 && (*s++ = *t++) != 0)
    ;
  *s = 0;
  return os;
}

